home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 013 / filecat2.arc / LITTLCAT.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1986-05-14  |  59.0 KB  |  2,043 lines

  1. {$C-}
  2.  
  3. PROGRAM LITTLCAT; { Written 5/12/86 by Kenn Flee, Madison WI }
  4.                   { Requires Turbo 3.X and Database ToolBox  }
  5.                   { Copyright (C) 1986 by Jamestown Software }
  6.                   { For NonCommercial use only.............. }
  7.  
  8. CONST
  9.   MaxDataRecSize = 100;
  10.   MaxKeyLen      =  20;
  11.   PageSize       =  24;
  12.   Order          =  12;
  13.   PageStackSize  =   8;
  14.   MaxHeight      =   5;
  15.  
  16. {.L-}
  17.  
  18. {$I ACCESS.BOX}
  19. {$I GETKEY.BOX}
  20. {$I ADDKEY.BOX}
  21. {$I DELKEY.BOX}
  22. {$I SORT.BOX}
  23.  
  24. {.L+}
  25.  
  26. TYPE
  27.   Name = String[12];
  28.   Str3 = String[3];
  29.   Str8 = String[8];
  30.   Str11 = String[11];
  31.   Str15 = String[15];
  32.   Str42 = String[42];
  33.   Str79 = String[79];
  34.   Str80 = String[80];
  35.   Str255 = String[255];
  36.   AnyStr = String[255];
  37.   CharSet = Set of Char;
  38.   Reg = Record case Integer of
  39.           1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer);
  40.           2: (AL,AH,BL,BH,CL,CH,DL,DH          : Byte);
  41.         End;
  42.   FRec = Record
  43.            Status   : Integer;
  44.            FileName : Str8;
  45.            FileExt  : Str3;
  46.            FileTime : Integer;
  47.            FileDate : Integer;
  48.            FileSize : Array[1..4] of Byte;
  49.            VolName  : Str11;
  50.          End;
  51.   EA = Array[1..250] of FRec;
  52.  
  53. VAR
  54.   ExFile : File;
  55.   FileName : Name;
  56.   MatchName : Str11;
  57.   Ch : Char;
  58.   MenuChoice : Char;
  59.   TDate : Str8;
  60.   CMode,NewMenu,
  61.   InitFiles :Boolean;
  62.   CFile  : DataFile;
  63.   CIndex : IndexFile;
  64.   DOSNum : Str3;
  65.   Error : Integer;
  66.   SortKey : Str42;
  67.   DTA3 : Array[1..43] of Char;
  68.   ASCIIZ : Array[1..64] of Char;
  69.   FileRec         : FRec;
  70.   Regs            : Reg;
  71.   OldVolumeName   : String[11];
  72.   OldVolumeNameDate : String[20];
  73.   EntryDirectory,
  74.   SourceDirectory : Str80;
  75.   Day,Month,Year,
  76.   Hour,Minute  : Integer;
  77.   Size         : Real;
  78.   AP           : Char;
  79.   Entry        : EA;
  80.   FTemp        : FRec;
  81.   EntryNum     : Integer;
  82.   FKey         : String[14];
  83.   PrintCount   : Integer;
  84.   FirstCharDelete : Boolean;
  85.   DiskMatch : Boolean;
  86.  
  87. PROCEDURE BigWindow(a,b,c,d:Integer);
  88.   Begin
  89.     Window(a,b,c,d);
  90.     { delete next line if NOT using Turbo Extender }
  91.     { CloneCodeSegment(TurboRunDataStart,TurboRunDataLength); }
  92.   End; { procedure BigWindow(a,b,c,d:Integer) }
  93.  
  94. CONST  VideoEnable = $08;               { Video Signal Enable Bit }
  95.        On  = True;
  96.        Off = False;
  97.  
  98. TYPE   Imagetype  = Array[1..4000] of char;  { Screen Image }
  99.  
  100. VAR    Screen      : Record
  101.                        Image: Imagetype;
  102.                        X1,Y1:   Integer;
  103.                      End;
  104.        Crtmode     : Byte      ABSOLUTE $0040:$0049;
  105.        Monobuffer  : Imagetype ABSOLUTE $B000:$0000;
  106.        Colorbuffer : Imagetype ABSOLUTE $B800:$0000;
  107.        CrtAdapter  : Integer   ABSOLUTE $0040:$0063;
  108.        VideoMode   : Byte      ABSOLUTE $0040:$0065;
  109.        CurrentSaved : Boolean;
  110.  
  111.  
  112. PROCEDURE Video(Switch:Boolean); { Video On/Off to avoid Read/Write snow }
  113.   Begin
  114.     If (Switch=Off) then Port[CrtAdapter+4] := (VideoMode-VideoEnable)
  115.       Else Port[CrtAdapter+4] := (VideoMode or VideoEnable);
  116.   End;
  117.  
  118. PROCEDURE SaveScreen;
  119.   Begin
  120.     If NOT CurrentSaved then begin
  121.       Video(Off);
  122.       With Screen Do Begin
  123.         X1:=WhereX;
  124.         Y1:=WhereY;
  125.         If CrtMode = 7 then Image := Monobuffer Else Image := Colorbuffer ;
  126.       End;
  127.       Video(On);
  128.       CurrentSaved:=True;
  129.     End;
  130.   End; { procedure SaveScreen }
  131.  
  132. PROCEDURE RestoreScreen;
  133.   Begin
  134.     If CurrentSaved then begin
  135.       Video(Off);
  136.       With Screen Do Begin
  137.         If CrtMode = 7 then Monobuffer := Image Else Colorbuffer := Image;
  138.         GotoXY(X1,Y1);
  139.       End;
  140.       Video(On);
  141.       CurrentSaved:=False;
  142.     End;
  143.   End; { procedure RestoreScreen; }
  144.  
  145. VAR
  146.   INT24Err: Boolean;
  147.   INT24ErrCode: Byte;
  148.   OldINT24: Array [1..2] Of Integer;
  149.  
  150. Procedure INT24;
  151.   Begin
  152.     Inline
  153.      ($2E/$C6/$06/ INT24Err /$01/$89/$EC/$83/$C4/$08/$89/$F8/$2E/$A2/
  154.       INT24ErrCode /$58/$B0/$FF/$5B/$59/$5A/$5E/$5F/$5D/$1F/$07/$CF);
  155.   End;
  156.  
  157. Procedure INT24On;
  158.   Begin
  159.     INT24Err:=False;
  160.     With Regs Do
  161.      Begin
  162.       AX:=$3524;
  163.       MsDos(Regs);
  164.       If (OldINT24[1] Or OldINT24[2])=0 Then
  165.        Begin
  166.         OldINT24[1]:=ES;
  167.         OldINT24[2]:=BX;
  168.        End;
  169.       DS:=CSeg;
  170.       DX:=Ofs(INT24);
  171.       AX:=$2524;
  172.       MsDos(Regs);
  173.      End;
  174.   End;
  175.  
  176. Procedure INT24Off;
  177.   Begin
  178.     INT24Err:=False;
  179.     If OldINT24[1]<>0 Then
  180.       With Regs Do
  181.        Begin
  182.         DS:=OldINT24[1];
  183.         DX:=OldINT24[2];
  184.         AX:=$2524;
  185.         MsDos(Regs);
  186.        End;
  187.     OldINT24[1]:=0;
  188.     OldINT24[2]:=0;
  189.   End;
  190.  
  191. Function INT24Result: Integer;
  192.   VAR I:Integer;
  193.   Begin
  194.     I:=IOResult;
  195.     If INT24Err Then
  196.      Begin
  197.       I:=I+256*INT24ErrCode;
  198.       INT24On;
  199.      End;
  200.     INT24Result:=I;
  201.   End;
  202.  
  203. FUNCTION ChangedToSource: Boolean;
  204.   Begin
  205.     INT24On;
  206.     {$I-}
  207.     ChDir(SourceDirectory);
  208.     {$I+}
  209.     ChangedToSource:=(INT24Result=0);
  210.     INT24Off;
  211.   End; { function ChangedToSource }
  212.  
  213. FUNCTION CheckDOSVersion:Str3;
  214.   VAR S,S1:Str3;
  215.   Begin
  216.     Regs.AX := $3000;       { Func.Call $30 (Get DOS Version Number) }
  217.     MsDos(Regs);
  218.     Str(Regs.AL,S);
  219.     Str(Regs.AH,S1);
  220.     CheckDOSVersion:=S+'.'+S1;
  221.     If NOT (S[1] in ['2','3']) then begin
  222.       ClrScr;
  223.       Write(^G);
  224.       GotoXY(10,17);
  225.       WriteLn('Sorry...  LITTLCAT requires DOS 2.X or greater.');
  226.       Halt;
  227.     End;
  228.   End; { function CheckDOSVersion }
  229.  
  230. FUNCTION ConstStr(C:Char; N:Integer) : Str80;
  231.   VAR S : String[80];
  232.   Begin
  233.     If N<0 then N:=0;
  234.     S[0] := Chr(N);
  235.     FillChar(S[1],N,C);
  236.     ConstStr := S;
  237.   End;
  238.  
  239. FUNCTION PrTest: Boolean;
  240.   VAR I : Integer;
  241.   Begin
  242.     Regs.ax:=$0200;
  243.     Regs.dx:=$0000;
  244.     Intr($17,Regs);
  245.     I := ((regs.ax and $FF00) shr 8);
  246.     If (I=144) then PrTest := True
  247.       Else PrTest := False;
  248.   End; { function PrTest }
  249.  
  250. FUNCTION MonitorType : Integer;
  251.   Begin
  252.     MonitorType := Mem[$0040:$0049];
  253.   End; { function MonitorType }
  254.  
  255. PROCEDURE HideCursor;
  256.   Begin
  257.     Inline($B9/$0F00/$B4/$01/$CD/$10);
  258.   End; { procedure HideCursor }
  259.  
  260. PROCEDURE RestoreCursor;
  261.   Begin
  262.     If MonitorType = 7 then                  { Mono }
  263.       Inline($B9/$0C0D/$B4/$01/$CD/$10)
  264.     Else Inline($B9/$0607/$B4/$01/$CD/$10);  { CGA }
  265.   End; { procedure RestoreCursor }
  266.  
  267. PROCEDURE Beep;
  268.   Begin
  269.     Sound(660);Delay(60);
  270.     Sound(440);Delay(60);
  271.     Sound(660);Delay(60);
  272.     Sound(440);Delay(60);
  273.     NoSound;
  274.   End;
  275.  
  276. FUNCTION Yes: Boolean;
  277.   VAR Ch:Char;
  278.   Begin
  279.     Repeat
  280.       Read(Kbd,Ch);
  281.       Ch:=UpCase(Ch);
  282.       If Not (Ch in ['Y','N']) then Beep;
  283.     Until Ch in ['Y','N'];
  284.     Yes := (Ch='Y');
  285.   End; { function Yes }
  286.  
  287. PROCEDURE DrawBox (Left, Right, Top, Bottom : Integer);
  288.   VAR
  289.    Index : Integer;
  290.   Begin
  291.     HideCursor;
  292.     GotoXY(Left,Top);
  293.     Write('┌');
  294.     For Index := Left+1 to Right-1 DO Begin
  295.       Write('─');
  296.     End;
  297.     Write('┐');
  298.     For Index := Top+1 to Bottom-1 Do Begin
  299.       GotoXY(Left,Index);
  300.       Write('│');
  301.       GotoXY(Right,Index);
  302.       Write('│');
  303.     End;
  304.     GotoXY(Left,Bottom);
  305.     Write('└');
  306.     For Index := Left+1 to Right-1 Do Begin
  307.       Write('─');
  308.     End;
  309.     Write('┘');
  310.     RestoreCursor;
  311.   End;
  312.  
  313. FUNCTION DOSDate:Str8;
  314.   VAR
  315.     month,day:     string[2];
  316.     year:          string[4];
  317.   Begin
  318.     Regs.AX:=$2A00;
  319.     MsDos(Regs);
  320.     with Regs do begin
  321.       Str(CX,year);
  322.       Str(DX mod 256,day);
  323.       Str(DX shr 8,month);
  324.     end;
  325.     Year:=Copy(Year,3,2);
  326.     If Length(Day) = 1 then Day:='0'+Day;
  327.     DOSdate := month + '/' + day + '/' + year  ;
  328.   End;
  329.  
  330. FUNCTION Freespace:real;
  331.   VAR  fr : real;
  332.   Begin
  333.     with regs do begin
  334.       dx := 0;
  335.       ah := $36;
  336.       MsDos(regs);
  337.       fr := bx;
  338.       if ax <> $FFFF then Freespace := fr * ax * cx else Freespace := 0
  339.     End;
  340.   End;  { function Freespace }
  341.  
  342. PROCEDURE SetDTA3;
  343.   Begin
  344.     Regs.AX := $1A00;       { Func.Call $1A (Set DTA) }
  345.     Regs.DS := Seg(DTA3);
  346.     Regs.DX := Ofs(DTA3);
  347.     MsDos(Regs);
  348.   End; { procedure SetDTA3 }
  349.  
  350. PROCEDURE SetASCIIZ(FName:Name);
  351.   VAR I:Integer;
  352.   Begin
  353.     FillChar(ASCIIZ,SizeOf(ASCIIZ),0);
  354.     For I:=1 to Length(FName) do ASCIIZ[I]:=FName[I];
  355.   End; { procedure SetASCIIZ }
  356.  
  357. PROCEDURE FindFirst3(Att:Integer);
  358.   Begin
  359.     SetDTA3;
  360.     Regs.AX := $4E00;       { Func.Call $4E (Find First) }
  361.     Regs.DS := Seg(ASCIIZ);
  362.     Regs.DX := Ofs(ASCIIZ);
  363.     Regs.CX := Att;
  364.     MsDos(Regs);
  365.     Error:=Regs.AX;
  366.   End; { procedure FindFirst3 }
  367.  
  368. PROCEDURE FindNext3;
  369.   Begin
  370.     SetDTA3;
  371.     Regs.AX := $4F00;       { Func.Call $4F (Find Next) }
  372.     Regs.DS := Seg(ASCIIZ);
  373.     Regs.DX := Ofs(ASCIIZ);
  374.     MsDos(Regs);
  375.     Error:=Regs.AX;
  376.   End; { procedure FindNext3 }
  377.  
  378. PROCEDURE GetName3;
  379.   VAR
  380.     I:Integer;
  381.     S,S1:String[15];
  382.     Name:Array[1..13] of Char;
  383.   Begin
  384.     S:=#0;
  385.     S1:='';
  386.     For I:=31 to 43 do Name[I-30]:=DTA3[I];
  387.     For I:=31 to 30+Pos(S,Name) do S1:=S1+DTA3[I];
  388.     I:=Pos('.',S1);
  389.     With Entry[EntryNum] do begin
  390.       Status:=0;
  391.       If I=0 then begin
  392.         FileName:=S1;
  393.         FileExt:='';
  394.       End Else begin
  395.         FileName:=Copy(S1,1,I-1);
  396.         FileExt:=Copy(S1,I+1,3);
  397.       End;
  398.       S:=FileName;
  399.       S:=S+ConstStr(' ',8-Length(S));
  400.       FileName:=S;
  401.       S:=FileExt;
  402.       S:=S+ConstStr(' ',3-Length(S));
  403.       FileExt:=S;
  404.       FileTime:=Ord(DTA3[24]);
  405.       FileTime:=FileTime shl 8;
  406.       FileTime:=FileTime or Ord(DTA3[23]);
  407.       FileDate:=Ord(DTA3[26]);
  408.       FileDate:=FileDate shl 8;
  409.       FileDate:=FileDate or Ord(DTA3[25]);
  410.       For I:=1 to 4 do FileSize[I]:=Ord(DTA3[I+26]);
  411.     End;  { with }
  412.   End; { procedure GetName3 }
  413.  
  414. PROCEDURE BuildArray;
  415.   Begin
  416.     If Not ChangedToSource then Beep;
  417.     EntryNum:=0;
  418.     FillChar(Entry,SizeOf(Entry),0);
  419.     SetASCIIZ('*.*');
  420.     FindFirst3(0);
  421.     If Error=0 then begin
  422.       EntryNum:=EntryNum+1;
  423.       GetName3;
  424.     End;
  425.     If Error=0 then begin
  426.       Repeat
  427.       FindNext3;
  428.       If (Error=0) and (EntryNum<250) then begin
  429.         EntryNum:=EntryNum+1;
  430.         GetName3;
  431.       End;
  432.       Until Error<>0;
  433.     End;
  434.   End; { procedure BuildArray }
  435.  
  436. PROCEDURE DisplayID;
  437.   Procedure Center(R:Integer;D:Str80);
  438.     Begin
  439.       GotoXY((80 -Length(D)) div 2,R);
  440.       Write(D);
  441.     End;
  442.   Begin
  443.     ClrScr;
  444.     DrawBox(10,70,1,6);
  445.     HideCursor;
  446.     Center(2,'LITTLCAT.COM -- A "little" CATALOGING UTILITY  V1.0');
  447.     Center(3,'----------');
  448.     LowVideo;
  449.     Center(4,'Program written by Kenn Flee of Jamestown Software');
  450.     Center(5,'2508 Valley Forge Dr., Madison WI 53719  (C)1986');
  451.     NormVideo;
  452.     RestoreCursor;
  453.   End;
  454.  
  455. FUNCTION Exist(FileName : Str80) : Boolean;
  456.   VAR
  457.     Fil : file;
  458.   Begin
  459.     Assign(Fil,FileName);
  460.     {$I-}
  461.     Reset(Fil);
  462.     {$I+}
  463.     Exist := (IOResult=0);
  464.     Close(Fil);
  465.   End;
  466.  
  467. PROCEDURE KillTemp;
  468.   Begin
  469.     If Exist('LITTLCAT.TMP') then begin
  470.       Assign(ExFile,'LITTLCAT.TMP');
  471.       Erase(ExFile);
  472.     End;
  473.   End; { procedure KillTemp }
  474.  
  475. TYPE FieldType = (Af,Nf,Rf,Df,Yf);    { Alpha, Numeric, Real, Date, Yes/No }
  476.  
  477. PROCEDURE InputStr (VAR S : AnyStr;
  478.                         L,X,Y : Integer;
  479.                         FType : FieldType;
  480.                         Term : CharSet;
  481.                     VAR TC : Char);
  482.   CONST
  483.     UnderScore = '_';
  484.   VAR
  485.     P : Integer;
  486.     Ch,Ch2 : Char;
  487.     LegalChar : CharSet;
  488.     FirstChar : Boolean;
  489.     EntryString : AnyStr;
  490.     X1,X2,X3 : Integer;
  491.     Error : Boolean;
  492.   Begin
  493.     Case FType of
  494.       Af : LegalChar := [' '..'~'];             { Alpha }
  495.       Nf : LegalChar := ['-','0'..'9'];         { Numeric }
  496.       Rf : LegalChar := ['-','.','0'..'9'];     { Real }
  497.       Df : LegalChar := ['/','0'..'9'];         { Date }
  498.       Yf : LegalChar := ['Y','y','N','n'];      { Yes/No }
  499.     End; { case }
  500.     GotoXY(X,Y); Write(S,ConstStr(UnderScore,L-Length(S)));
  501.     P := 0;
  502.     FirstChar := True;
  503.     EntryString := S;
  504.     Repeat
  505.       GotoXY(X+P,Y);
  506.       Read(Kbd,Ch);
  507.       If ((Ch in [#32..#126]) and FirstChar) and FirstCharDelete then begin
  508.         P:=0;
  509.         S:='';
  510.         Write(S,ConstStr(UnderScore,L-Length(S)));
  511.         GotoXY(X+P,Y);
  512.       End;
  513.       FirstChar := False;
  514.       Case Ch of
  515.         #32..#126 : If (P<L) and (Ch in LegalChar) then
  516.                     Begin
  517.                       If FType = Yf then begin
  518.                         Case Ch of
  519.                           'Y','y' : S := 'Yes';
  520.                           'N','n' : S := 'No ';
  521.                         End;
  522.                         P:=0;
  523.                         GotoXY(X+P,Y);
  524.                         Write(S,ConstStr(UnderScore,L-Length(S)));
  525.                         Ch := #13;
  526.                       End Else begin
  527.                         If Length(S)=L then Delete(S,L,1);
  528.                         P := P+1;
  529.                         Insert(Ch,S,P);
  530.                         Write(Copy(S,P,L));
  531.                       End;
  532.                     End
  533.                     Else Beep;
  534.                ^H : If P>0 then
  535.                     Begin
  536.                       Delete(S,P,1);
  537.                       Write(^H,Copy(S,P,L),UnderScore);
  538.                       P := P-1;
  539.                     End
  540.                     Else Beep;
  541.               #27 : If KeyPressed then Begin
  542.                       Read(Kbd,Ch2);
  543.                       Case Ch2 of
  544.  
  545.                       { Func. Codes: F1=59 F2=60 F3=61 ... F10=68 }
  546.  
  547.                       #59 : Ch := ^Q;
  548.                       #62 : Begin
  549.                               P:=0;
  550.                               S:='';
  551.                               GotoXY(X+P,Y);
  552.                               Write(S,ConstStr(UnderScore,L-Length(S)));
  553.                             End;
  554.                       #66 : Begin
  555.                               FirstCharDelete := NOT FirstCharDelete;
  556.                               Ch := #13;
  557.                             End;
  558.                       #68 : Ch := ^Z;
  559.  
  560.                       { Keypad Codes:  71 72 73
  561.                                        75 76 77
  562.                                        79 80 81
  563.                                     -82- -83-    }
  564.  
  565.                       #75 : If P>0 then P := P-1
  566.                             Else Beep;
  567.                       #77 : If P<Length(S) then P := P+1
  568.                             Else Beep;
  569.                       #79 : P := Length(S);
  570.                       #71 : P := 0;
  571.                       #72 : Ch := ^E;
  572.                       #80 : Ch := ^X;
  573.                       #83 : If P<Length(S) then
  574.                             Begin
  575.                               Delete(S,P+1,1);
  576.                               Write(Copy(S,P+1,L),UnderScore);
  577.                             End;
  578.                       End; {case}
  579.                     End Else Begin
  580.                       S := EntryString;
  581.                       P:=0;
  582.                       GotoXY(X+P,Y);
  583.                       Write(S,ConstStr(UnderScore,L-Length(S)));
  584.                       Ch := #13;
  585.                     End; {begin}
  586.       End; {case}
  587.       If (Ch in Term) and (FType = Df) then begin
  588.         Error := False;
  589.         Val(Copy(S,1,2),X3,X2);
  590.         If X2<>0 then Error := True;
  591.         Val(Copy(S,4,2),X1,X2);
  592.         If X2=0 then
  593.           Case X1 of
  594.             4,6,9,11        : If NOT (X3 in [1..30]) then Error := True;
  595.             1,3,5,7,8,10,12 : If NOT (X3 in [1..31]) then Error := True;
  596.             2               : If NOT (X3 in [1..29]) then Error := True
  597.            Else Error := True;
  598.         End Else Error := True;
  599.         Val(Copy(S,7,2),X1,X2);
  600.         If X2<>0 then Error := True;
  601.         If X2=0 then If X1<85 then Error := True;
  602.         If Error then begin
  603.           Beep;
  604.           P:=0;
  605.           S:=EntryString;
  606.           GotoXY(X+P,Y);
  607.           Write(S,ConstStr(UnderScore,L-Length(S)));
  608.           Ch := #0;
  609.           FirstChar := True;
  610.         End;
  611.       End;
  612.     Until Ch in Term;
  613.     P := Length(S);
  614.     GotoXY(X+P,Y); Write('':L-P);
  615.     TC := Ch;
  616.   End;
  617.  
  618. PROCEDURE QuickSortRecord(VAR Item:EA; Count:Integer);
  619.   PROCEDURE QuickSort(SBegin,SCount:Integer;VAR It:EA);
  620.     VAR I,J:Integer;
  621.         X1,X2:FRec;
  622.     Begin
  623.       I:=SBegin;
  624.       J:=SCount;
  625.       X1:=It[(SBegin+SCount) div 2];
  626.       Repeat
  627.         While (It[I].FileName+It[I].FileExt) < (X1.FileName+X1.FileExt) do I:=I+1;
  628.         While (X1.FileName+X1.FileExt) < (It[J].FileName+It[J].FileExt) do J:=J-1;
  629.         If I<=J then begin
  630.           X2:=Entry[I];
  631.           Entry[I]:=Entry[J];
  632.           Entry[J]:=X2;
  633.           I:=I+1;
  634.           J:=J-1;
  635.         End;
  636.       Until I>J;
  637.       If SBegin<J then QuickSort(SBegin,J,It);
  638.       If SBegin<SCount then QuickSort(I,SCount,It);
  639.     End; { procedure QuickSort }
  640.     Begin
  641.       QuickSort(1,Count,Item);
  642.     End;  { procedure QuickSortRecord }
  643.  
  644. PROCEDURE Boop;
  645.   Begin
  646.     Sound(330);
  647.     Delay(120);
  648.     NoSound;
  649.   End; { procedure Boop }
  650.  
  651. PROCEDURE OpenFiles;
  652.   Begin
  653.     ChDir(EntryDirectory);
  654.     OpenFile(CFile,'LITTLCAT.DAT',SizeOf(FRec));
  655.     OpenIndex(CIndex,'LITTLCAT.IXN',14,1);
  656.   End; { procedure OpenFiles }
  657.  
  658. PROCEDURE CloseFiles;
  659.   Begin
  660.     ChDir(EntryDirectory);
  661.     CloseFile(CFile);
  662.     CloseIndex(CIndex);
  663.   End; { procedure CloseFiles }
  664.  
  665. PROCEDURE Show(X,Y:Integer;S:Str80);
  666.   Begin
  667.     GotoXY(X,Y);
  668.     Write(S);
  669.   End; { procedure Show }
  670.  
  671. PROCEDURE ShowScreen;
  672.   Begin
  673.     ClrScr;
  674.     NormVideo;
  675.     Show(1,2,ConstStr(#196,80));
  676.     LowVideo;
  677.     Show(5,2,' FILE INFORMATION ');
  678.     Show( 3, 4,'   File Name:');
  679.     Show( 3, 5,'        Time:');
  680.     Show( 3, 6,'        Date:');
  681.     Show( 3, 7,'        Size:');
  682.     Show( 3, 8,' Volume/Path:');
  683.     NormVideo;
  684.     Show(1,10,ConstStr(#196,80));
  685.     Show(1,22,ConstStr(#196,80));
  686.   End; { procedure ShowScreen }
  687.  
  688. PROCEDURE UpdateArray;
  689.   VAR I,R : Integer;
  690.       S1,S2 : String[14];
  691.   Begin
  692.     OpenFiles;
  693.     For I:=1 to EntryNum do begin
  694.       Entry[I].Status:=0;
  695.       S1:=Entry[I].FileName+Entry[I].FileExt;
  696.       FKey:=S1;
  697.       ClearKey(CIndex);
  698.       SearchKey(CIndex,R,FKey);
  699.       If OK then Begin
  700.         S2:=Copy(FKey,1,11);
  701.         If S1=S2 then Entry[I].Status:=1;
  702.       End;
  703.     End;
  704.     CloseFiles;
  705.   End; { procedure UpdateArray }
  706.  
  707. PROCEDURE ShowEntry(N:Integer);
  708.   Begin
  709.     With Entry[N] do begin
  710.     GotoXY(17,4);
  711.     Write(FileName,'.',FileExt);
  712.       Size := (FileSize[1] * 1.0) +
  713.               (FileSize[2] * 256.0) +
  714.               (FileSize[3] * 65536.0);
  715.       Year := (FileDate shr 9) + 80;
  716.       Month := (FileDate shl 7) shr 12;
  717.       Day := (FileDate shl 11) shr 11;
  718.       Hour := FileTime shr 11;
  719.       If Hour >= 12 then begin
  720.         AP := 'p';
  721.         Hour := Hour - 12;
  722.       End Else AP := 'a';
  723.       If Hour = 0 then Hour := 12;
  724.       Minute := (FileTime shl 5) shr 10;
  725.     End;
  726.     GotoXY(17,5);
  727.     Write(Hour:2,':');
  728.     If Minute < 10 then Write('0');
  729.     Write(Minute,ap);
  730.     GotoXY(17,6);
  731.     Write(Month:2,'-');
  732.     If Day < 10 then Write('0');
  733.     Write(Day,'-',Year);
  734.     GotoXY(17,7);
  735.     Write(Size:0:0);
  736.     GotoXY(17,8);
  737.     If SourceDirectory[1] in ['A','B'] then Write(OldVolumeName)
  738.        Else Write(SourceDirectory);
  739.   End; { procedure ShowEntry }
  740.  
  741. PROCEDURE ShowData(RecNum:Integer);
  742.   Begin
  743.     FillChar(FileRec,SizeOf(FileRec),0);
  744.     GetRec(CFile,RecNum,FileRec);
  745.     With FileRec do begin
  746.       GotoXY(17,4);ClrEol;
  747.       Write(FileName,'.',FileExt);
  748.       GotoXY(60,4);ClrEol;
  749.       Write('Record No.: ',RecNum);
  750.       Size := (FileSize[1] * 1.0) +
  751.               (FileSize[2] * 256.0) +
  752.               (FileSize[3] * 65536.0);
  753.       Year := (FileDate shr 9) + 80;
  754.       Month := (FileDate shl 7) shr 12;
  755.       Day := (FileDate shl 11) shr 11;
  756.       Hour := FileTime shr 11;
  757.       If Hour >= 12 then begin
  758.         AP := 'p';
  759.         Hour := Hour - 12;
  760.       End Else AP := 'a';
  761.       If Hour = 0 then Hour := 12;
  762.       Minute := (FileTime shl 5) shr 10;
  763.       GotoXY(17,5);ClrEol;
  764.       Write(Hour:2,':');
  765.       If Minute < 10 then Write('0');
  766.       Write(Minute,ap);
  767.       GotoXY(17,6);
  768.       Write(Month:2,'-');
  769.       If Day < 10 then Write('0');
  770.       Write(Day,'-',Year);
  771.       GotoXY(17,7);ClrEol;
  772.       Write(Size:0:0);
  773.       GotoXY(17,8);ClrEol;
  774.       Write(VolName);
  775.     End;
  776.   End; { procedure ShowData }
  777.  
  778. PROCEDURE SetEpson;
  779.   CONST N = 26;
  780.   VAR TempCh :Char;
  781.       Left,I : Integer;
  782.       S:AnyStr;
  783.   Begin
  784.     If Monitortype=7 then begin
  785.       For I:=7 to 25 do begin
  786.         GotoXY(1,I);
  787.         ClrEol;
  788.       End;
  789.     End Else begin
  790.       BigWindow(1,7,80,25);
  791.       ClrScr;
  792.       BigWindow(1,1,80,25);
  793.     End;
  794.     If not PrTest then Repeat
  795.       Beep;
  796.       GotoXY(20,15);
  797.       WriteLn('Printer does not appear to be ready');
  798.       GotoXY(20,16);
  799.       WriteLn('Press any key when ready or ESC to return to menu');
  800.       Repeat until KeyPressed;
  801.       Read(Kbd,TempCh);
  802.       If (TempCh = #27) and KeyPressed then Read(Kbd,TempCh);
  803.       If TempCh = #27 then Exit;
  804.       If Monitortype=7 then begin
  805.         For I:=9 to 25 do begin
  806.           GotoXY(1,I);
  807.           ClrEol;
  808.         End;
  809.       End Else begin
  810.         BigWindow(1,9,80,25);
  811.         ClrScr;
  812.         BigWindow(1,1,80,25);
  813.       End;
  814.     Until PrTest;
  815.     GotoXY(N,10); WriteLn('1 -- Pica  (10 chars/inch)');
  816.     GotoXY(N,11); WriteLn('2 -- Elite (12 chars/inch)');
  817.     GotoXY(N,12); WriteLn('3 -- Cond  (17 chars/inch)');
  818.     GotoXY(N,13); WriteLn('4 -- Set Left Margin');
  819.     LowVideo;
  820.     GotoXY(N,16); WriteLn('9 -- Return to Main Menu');
  821.     NormVideo;
  822.     GotoXY(N,21); Write('Enter your selection: [ ]');
  823.     Left:=1;
  824.     TempCh:='1';
  825.     Write(Lst,#27,'@',#13);
  826.     Write(Lst,#27,'l',Chr(Left),#13);
  827.     Repeat
  828.       GotoXY(N,23);ClrEol;
  829.       Write('Left Margin set at ',Left,'  ');
  830.       Case TempCh of
  831.         '1' : Write('Pica');
  832.         '2' : Write('Elite');
  833.         '3' : Write('Condensed');
  834.       End;
  835.       GotoXY(N+23,21);
  836.       Read(Kbd,TempCh);
  837.       Write(TempCh);
  838.       Case TempCh of
  839.         '1' : Write(Lst,#27,#18,#27,'P',#13);
  840.         '2' : Write(Lst,#27,#18,#27,'M',#13);
  841.         '3' : Write(Lst,#27,'P',#27,#15,#13);
  842.         '4' : Begin
  843.                 Repeat
  844.                   GotoXY(N,23);ClrEol;
  845.                   Write('Set left margin at how many characters: ');
  846.                   ReadLn(S);
  847.                   Val(S,Left,I);
  848.                   If (Left<0) or (Left>20) then I:=1;
  849.                   If I<>0 then Boop;
  850.                 Until I=0;
  851.                 Write(Lst,#27,'l',Chr(Left),#13);
  852.               End;
  853.         '9' : ;
  854.       Else Boop;
  855.       End;
  856.     Until TempCh = '9';
  857.   End; {SetEpson}
  858.  
  859. FUNCTION SelectFile: Integer;
  860.   VAR TopLine,
  861.       BottomLine,
  862.       OldTop,
  863.       Current,
  864.       Last,I       : Integer;
  865.       DoAll : Boolean;
  866.   Begin
  867.     If KeyPressed then Repeat
  868.       Read(Kbd,Ch);
  869.     Until NOT Keypressed;
  870.     Current:=1;
  871.     Last:=1;
  872.     TopLine:=1;
  873.     BottomLine:=20;
  874.     If BottomLine>EntryNum then BottomLine:=EntryNum;
  875.     DoAll:=True;
  876.     HideCursor;
  877.     Repeat
  878.       If DoAll then begin
  879.         If Monitortype = 7 then begin
  880.           For I:= 1 to 23 do begin
  881.             GotoXY(1,I);
  882.             Write(ConstStr(' ',13));
  883.           End;
  884.           GotoXY(1,1);
  885.         End Else ClrScr;
  886.         For I:= TopLine to BottomLine do begin
  887.           LowVideo;
  888.           If Entry[I].Status=1 then TextColor(1);
  889.           If I=Current then begin
  890.             TextBackGround(7);
  891.             If Entry[I].Status=1 then TextColor(1) Else TextColor(0)
  892.           End;
  893.           WriteLn(Entry[I].FileName,' ',Entry[I].FileExt);
  894.         End;
  895.         OldTop:=TopLine;
  896.       End Else begin
  897.         GotoXY(1,1+(Current-TopLine));
  898.         TextBackGround(7);
  899.         If Entry[Current].Status=1 then TextColor(1) Else TextColor(0);
  900.         WriteLn(Entry[Current].FileName,' ',Entry[Current].FileExt);
  901.         OldTop:=TopLine;
  902.       End;
  903.       LowVideo;
  904.       GotoXY(1,21);ClrEol;
  905.       If BottomLine<EntryNum then Write('  ',#25,' MORE ',#25);
  906.       GotoXY(1,22);
  907.       TextColor(1);
  908.       Write(' Blue ');
  909.       LowVideo;
  910.       Write('= Dup');
  911.       Last:=Current;
  912.       Read(Kbd,Ch);
  913.       If (Ch=#27) and KeyPressed then Read(Kbd,Ch);
  914.       DoAll:=False;
  915.       Case Ch of
  916.         #72 : Current:=Current-1;       { up }
  917.         #80 : Current:=Current+1;       { down }
  918.         #71 : Current:=TopLine;         { home }
  919.         #79 : Current:=BottomLine;      { end }
  920.         #73 : Begin
  921.                 BottomLine:=BottomLine-20;   { pgup }
  922.                 DoAll:=True;
  923.               End;
  924.         #81 : Begin
  925.                 BottomLine:=BottomLine+20;   { pgdn }
  926.                 DoAll:=True;
  927.               End;
  928.         'S','s' : Begin
  929.                     QuickSortRecord(Entry,EntryNum);
  930.                     Current:=1;
  931.                     DoAll:=True;
  932.                   End;
  933.         #13 : ;
  934.       Else Boop;
  935.       End;
  936.       GotoXY(1,1+(Last-TopLine));
  937.       LowVideo;
  938.       If Entry[Last].Status=1 then TextColor(1);
  939.       WriteLn(Entry[Last].FileName,' ',Entry[Last].FileExt);
  940.       GotoXY(1,1);
  941.       If (Current=BottomLine+1) and (Current<=EntryNum) then DelLine;
  942.       If (Current=TopLine-1) and (Current>0) then begin
  943.         InsLine;
  944.         GotoXY(1,21);
  945.         DelLine;
  946.       End;
  947.       If Current<1 then Current:=1;
  948.       If Current>EntryNum then Current:=EntryNum;
  949.       If Current>TopLine+19 then BottomLine:=Current;
  950.       If Current<TopLine then TopLine:=Current;
  951.       If TopLine<>OldTop then BottomLine:=Topline+19;
  952.       If BottomLine<20 then BottomLine:=20;
  953.       If BottomLine>EntryNum then BottomLine:=EntryNum;
  954.       TopLine:=BottomLine-19;
  955.       If TopLine<1 then TopLine:=1;
  956.       If Current<TopLine then Current:=TopLine;
  957.       If Current>BottomLine then Current:=BottomLine;
  958.     Until Ch in [#13,#27,#59];
  959.     RestoreCursor;
  960.     If Ch=#27 then SelectFile:=0
  961.       Else If Ch=#59 then Selectfile:=-1
  962.       Else SelectFile:=Current;
  963.   End; { function SelectFile }
  964.  
  965. PROCEDURE volume(drivelet:Char;AskChange:Boolean);
  966.   TYPE
  967.     extendfcb = ARRAY[0..43] OF Char;
  968.   VAR
  969.     drive : byte;
  970.     i,filetime,filedate : Integer;
  971.     s : AnyStr;
  972.     haslabel : Boolean;
  973.     labl : string[11];
  974.     dta, xfcb, sfcb : extendfcb;
  975.  
  976.   PROCEDURE initfcb(VAR x : extendfcb; namechar : Char);
  977.     {initialize an extended fcb}
  978.     VAR
  979.       i : Integer;
  980.     BEGIN
  981.       x[0] := Chr(255);     {flag for extended FCB}
  982.       FOR i := 1 TO 5 DO x[i] := Chr(0);
  983.       x[6] := Chr(8);       {specifies that we want volume label}
  984.       x[7] := Chr(0);       {where drive number goes}
  985.       FOR i := 8 TO 18 DO x[i] := namechar;
  986.       FOR i := 19 TO 43 DO x[i] := Chr(0);
  987.     END;                    {initfcb}
  988.  
  989.   BEGIN
  990.     initfcb(sfcb, '?');     {initialize buffers}
  991.     initfcb(xfcb, ' ');
  992.     Drive:=Ord(DriveLet)-64;
  993.     sfcb[7] := Chr(drive);
  994.     xfcb[7] := Chr(drive);
  995.     regs.ax := $1A00;
  996.     regs.ds := Seg(dta[0]);
  997.     regs.dx := Ofs(dta[0]);
  998.     MsDos(regs);             {SET UP DISK TRANSFER AREA FOR FILENAMES}
  999.  
  1000.     regs.dx := Ofs(sfcb[0]);
  1001.     regs.ax := $1100;
  1002.     MsDos(regs);             {search for volume entry}
  1003.  
  1004.     IF Lo(regs.ax) = $FF THEN BEGIN
  1005.       haslabel := False;
  1006.       OldVolumeName := '<NONE>';
  1007.       OldVolumeNameDate := '';
  1008.       GotoXY(1,11); ClrEol;
  1009.       WriteLn('Diskette in drive ',drive,' has no label... please enter.');
  1010.     END ELSE BEGIN
  1011.       haslabel := True;
  1012.       OldVolumeName:='';
  1013.       FOR i := 1 TO 11 DO OldVolumeName:=OldVolumeName+(dta[7+i]);
  1014.       I:=11;
  1015.       While (OldVolumeName[I]=' ') and (I>0) do begin
  1016.         Delete(OldVolumeName,I,1);
  1017.         I:=I-1;
  1018.       End;
  1019.       filetime:=ord(dta[31]) shl 8 + ord(dta[30]);
  1020.       filedate:=ord(dta[33]) shl 8 + ord(dta[32]);
  1021.       Month := (FileDate shl 7) shr 12;
  1022.       Str(Month,S);
  1023.       OldVolumeNameDate := S + '-';
  1024.       Day := (FileDate shl 11) shr 11;
  1025.       If Day < 10 then OldVolumeNameDate := OldVolumeNameDate + '0';
  1026.       Str(Day,S);
  1027.       OldVolumeNameDate := OldVolumeNameDate + S + '-';
  1028.       Year := (FileDate shr 9) + 80;
  1029.       Str(Year,S);
  1030.       OldVolumeNameDate := OldVolumeNameDate + S + '  ';
  1031.       Hour := FileTime shr 11;
  1032.       If Hour >= 12 then begin
  1033.         AP := 'p';
  1034.         Hour := Hour - 12;
  1035.       End Else AP := 'a';
  1036.       If Hour = 0 then Hour := 12;
  1037.       Str(Hour:2,S);
  1038.       OldVolumeNameDate := OldVolumeNameDate + S + ':';
  1039.       Minute := (FileTime shl 5) shr 10;
  1040.       If Minute < 10 then OldVolumeNameDate := OldVolumeNameDate + '0';
  1041.       Str(Minute,S);
  1042.       OldVolumeNameDate := OldVolumeNameDate + S + AP;
  1043.     END;
  1044.     IF (HasLabel=False) or (AskChange) THEN Begin  {go on to change the label}
  1045.       Repeat
  1046.         Beep;
  1047.         GotoXY(30,10);ClrEol;
  1048.         ReadLn(labl);
  1049.         if (labl='') and (OldVolumeName<>'') then labl:=OldVolumeName;
  1050.         OldVolumeName:=labl;
  1051.       Until labl<>'';
  1052.       IF Length(labl) > 0 THEN BEGIN
  1053.         FOR i := 1 TO Length(labl) DO xfcb[7+i] := labl[i]; {insert label into xfcb}
  1054.         IF haslabel THEN BEGIN
  1055.           FOR i := 1 TO 11 DO dta[23+i] := xfcb[7+i]; {modify dta}
  1056.           regs.ds := Seg(dta[0]);
  1057.           regs.dx := Ofs(dta[0]);
  1058.           regs.ax := $1700;
  1059.           MsDos(regs);
  1060.         END ELSE BEGIN
  1061.           regs.ds := Seg(xfcb[0]);
  1062.           regs.dx := Ofs(xfcb[0]);
  1063.           regs.ax := $1600;
  1064.           MsDos(regs);
  1065.         END;
  1066.         GotoXY(1,11);ClrEol;
  1067.         IF Lo(regs.ax) = $FF THEN begin
  1068.           Boop;
  1069.           Write('Error in modifying label... press any key.');
  1070.           Read(Kbd,Ch);
  1071.         End ELSE Write(labl,' successfully created.');
  1072.       END;
  1073.     End;
  1074.   END; {volume}
  1075.  
  1076. PROCEDURE TestIt;
  1077.   VAR I,R,N,MatchCount : Integer;
  1078.       S1,S2,S3 : String[14];
  1079.       K,K2 : String[6];
  1080.   Begin
  1081.     SaveScreen;
  1082.     PrintCount:=0;
  1083.     ClrScr;
  1084.     If not PrTest then Repeat
  1085.       Beep;
  1086.       DrawBox(10,70,16,21);
  1087.       BigWindow(11,17,69,20);
  1088.       If MonitorType = 7 then begin
  1089.         HideCursor;
  1090.         For I:=1 to 4 do begin
  1091.           GotoXY(1,I);
  1092.           Write(ConstStr(' ',59));
  1093.         End;
  1094.         RestoreCursor;
  1095.       End Else ClrScr;
  1096.       HideCursor;
  1097.       GotoXY(5,2); WriteLn('Printer does not appear to be ready');
  1098.       GotoXY(5,3); WriteLn('Press any key when ready or ESC to return to menu');
  1099.       Repeat until KeyPressed;
  1100.       Read(Kbd,Ch);
  1101.       BigWindow(1,1,80,25);
  1102.       ClrScr;
  1103.       HideCursor;
  1104.       If (Ch = #27) and KeyPressed then Read(Kbd,Ch);
  1105.       If Ch = #27 then begin
  1106.         RestoreScreen;
  1107.         Exit;
  1108.       End;
  1109.     Until PrTest;
  1110.     OpenFiles;
  1111.     MatchCount:=0;
  1112.     For I:=1 to EntryNum do begin
  1113.       S1:=Entry[I].FileName+Entry[I].FileExt;
  1114.       WriteLn('Checking ',Entry[I].FileName,'.',Entry[I].FileExt);
  1115.       FKey:=S1;
  1116.       ClearKey(CIndex);
  1117.       SearchKey(CIndex,R,FKey);
  1118.       If OK then Repeat
  1119.         S2:=Copy(FKey,1,11);
  1120.         If S1=S2 then Begin
  1121.           If PrintCount=0 then Begin
  1122.             WriteLn(Lst,'Listing of duplicate file NAMES found on ',OldVolumeName,' on ',TDate);
  1123.             WriteLn(Lst,ConstStr('-',79));
  1124.             WriteLn(Lst);
  1125.             PrintCount:=3;
  1126.           End;
  1127.           GetRec(CFile,R,FileRec);
  1128.           If FileRec.VolName<>OldVolumeName then begin
  1129.             MatchCount:=MatchCount+1;
  1130.             S3:=FileRec.FileName+'.'+FileRec.FileExt;
  1131.             Write(Lst,S3,' exists on disk ');
  1132.             Write(Lst,FileRec.VolName,' with same name');
  1133.             If (Entry[I].FileDate=FileRec.FileDate) and
  1134.                (Entry[I].FileSize[1]=FileRec.FileSize[1]) and
  1135.                (Entry[I].FileSize[2]=FileRec.FileSize[2]) and
  1136.                (Entry[I].FileSize[3]=FileRec.FileSize[3]) and
  1137.                (Entry[I].FileSize[4]=FileRec.FileSize[4]) then
  1138.                WriteLn(Lst,', size and date')
  1139.             Else WriteLn(Lst);
  1140.             PrintCount:=PrintCount+1;
  1141.             If PrintCount >=55 then begin
  1142.               Write(Lst,#12);
  1143.               PrintCount:=0;
  1144.             End;
  1145.           End;
  1146.         End;
  1147.         NextKey(CIndex,R,FKey);
  1148.         S2:=Copy(FKey,1,11);
  1149.       Until S1<>S2;
  1150.     End;
  1151.     ClrScr;
  1152.     GotoXY(30,10);
  1153.     Beep;
  1154.     WriteLn(MatchCount,' matches found.');
  1155.     If MatchCount>0 then begin
  1156.       WriteLn(Lst);
  1157.       WriteLn(Lst,MatchCount,' matches found.');
  1158.       MatchCount:=0;
  1159.     End;
  1160.     If PrintCount>0 then Write(Lst,#12);
  1161.     PrintCount:=0;
  1162.     GotoXY(8,12);
  1163.     Write('Do you also wish to check for possible Date/Size duplicates?  Y/N');
  1164.     If Yes then begin
  1165.       ClrScr;
  1166.       CloseIndex(CIndex);
  1167.       If NOT (Exist('LITTLCAT.TMP')) then begin
  1168.         Write('Please wait... building new index:');
  1169.         MakeIndex(CIndex,'LITTLCAT.TMP',6,1);
  1170.         HideCursor;
  1171.         For N := 1 to FileLen(CFile)-1 do begin
  1172.           GetRec(CFile,N,FTemp);
  1173.           If FTemp.Status=0 then begin
  1174.             GotoXY(37,WhereY);ClrEol;
  1175.             Write(N);
  1176.             K:='      ';
  1177.             For I:= 1 to 4 do K[I]:=Chr(Ord(FTemp.FileSize[I]));
  1178.             K[5]:=Chr(Hi(FTemp.FileDate));
  1179.             K[6]:=Chr(Lo(FTemp.FileDate));
  1180.             AddKey(CIndex,N,K);
  1181.           End;
  1182.         End;
  1183.         RestoreCursor;
  1184.         WriteLn;
  1185.       End Else OpenIndex(CIndex,'LITTLCAT.TMP',6,1);
  1186.       For I:=1 to EntryNum do begin
  1187.         K2:='      ';
  1188.         For R:= 1 to 4 do K2[R]:=Chr(Ord(Entry[I].FileSize[R]));
  1189.         K2[5]:=Chr(Hi(Entry[I].FileDate));
  1190.         K2[6]:=Chr(Lo(Entry[I].FileDate));
  1191.         WriteLn('Checking ',Entry[I].FileName,'.',Entry[I].FileExt);
  1192.         FKey:=K2;
  1193.         ClearKey(CIndex);
  1194.         FindKey(CIndex,R,K2);
  1195.         If OK then Begin
  1196.           If PrintCount=0 then Begin
  1197.             WriteLn(Lst,'Listing of duplicate file SIZE/DATEs found on ',OldVolumeName,' on ',TDate);
  1198.             WriteLn(Lst,ConstStr('-',79));
  1199.             WriteLn(Lst);
  1200.             PrintCount:=3;
  1201.           End;
  1202.           GetRec(CFile,R,FTemp);
  1203.           If FTemp.VolName<>OldVolumeName then begin
  1204.             MatchCount:=MatchCount+1;
  1205.             Write(Lst,Entry[I].FileName,'.',Entry[I].FileExt);
  1206.             Write(Lst,' has same date and size as ',FTemp.FileName,'.',FTemp.FileExt);
  1207.             WriteLn(Lst,' on disk ',FTemp.VolName);
  1208.             PrintCount:=PrintCount+1;
  1209.             If PrintCount >=55 then begin
  1210.               Write(Lst,#12);
  1211.               PrintCount:=0;
  1212.             End;
  1213.           End;
  1214.           Repeat
  1215.             NextKey(CIndex,R,K2);
  1216.             If (FKey=K2) and OK then begin
  1217.               If PrintCount=0 then Begin
  1218.                 WriteLn(Lst,'Duplicate file SIZE/DATEs found on ',SourceDirectory,' on ',TDate);
  1219.                 WriteLn(Lst,ConstStr('-',79));
  1220.                 WriteLn(Lst);
  1221.                 PrintCount:=3;
  1222.               End;
  1223.               GetRec(CFile,R,FTemp);
  1224.               If FTemp.VolName<>OldVolumeName then begin
  1225.                 MatchCount:=MatchCount+1;
  1226.                 Write(Lst,Entry[I].FileName,'.',Entry[I].FileExt);
  1227.                 Write(Lst,' has same date and size as ',FTemp.FileName);
  1228.                 WriteLn(Lst,' on disk ',FTemp.VolName);
  1229.                 PrintCount:=PrintCount+1;
  1230.                 If PrintCount >=55 then begin
  1231.                   Write(Lst,#12);
  1232.                   PrintCount:=0;
  1233.                 End;
  1234.               End;
  1235.             End;
  1236.           Until (K2<>FKey) or (NOT OK);
  1237.         End;
  1238.       End;
  1239.       If MatchCount>0 then begin
  1240.         WriteLn(Lst);
  1241.         WriteLn(Lst,MatchCount,' matches found.');
  1242.         MatchCount:=0;
  1243.       End;
  1244.       If PrintCount>0 then Write(Lst,#12);
  1245.     End;
  1246.     PrintCount:=0;
  1247.     RestoreScreen;
  1248.     RestoreCursor;
  1249.     CloseFiles;
  1250.   End; { procedure TestIt }
  1251.  
  1252. PROCEDURE TestIt2;
  1253.   VAR I,R,N,MatchCount : Integer;
  1254.       S1,S2 : String[14];
  1255.   Begin
  1256.     SaveScreen;
  1257.     PrintCount:=0;
  1258.     ClrScr;
  1259.     If not PrTest then Repeat
  1260.       Beep;
  1261.       DrawBox(10,70,16,21);
  1262.       BigWindow(11,17,69,20);
  1263.       If MonitorType = 7 then begin
  1264.         HideCursor;
  1265.         For I:=1 to 4 do begin
  1266.           GotoXY(1,I);
  1267.           Write(ConstStr(' ',59));
  1268.         End;
  1269.         RestoreCursor;
  1270.       End Else ClrScr;
  1271.       HideCursor;
  1272.       GotoXY(5,2); WriteLn('Printer does not appear to be ready');
  1273.       GotoXY(5,3); WriteLn('Press any key when ready or ESC to return to menu');
  1274.       Repeat until KeyPressed;
  1275.       Read(Kbd,Ch);
  1276.       BigWindow(1,1,80,25);
  1277.       ClrScr;
  1278.       HideCursor;
  1279.       If (Ch = #27) and KeyPressed then Read(Kbd,Ch);
  1280.       If Ch = #27 then begin
  1281.         RestoreScreen;
  1282.         Exit;
  1283.       End;
  1284.     Until PrTest;
  1285.     OpenFiles;
  1286.     MatchCount:=0;
  1287.     FKey:='';
  1288.     ClearKey(CIndex);
  1289.     SearchKey(CIndex,R,FKey);
  1290.     N:=R;
  1291.     S1:=Copy(FKey,1,11);
  1292.     While OK do begin
  1293.       WriteLn('Checking ',S1);
  1294.       NextKey(CIndex,R,FKey);
  1295.       S2:=Copy(FKey,1,11);
  1296.       If (S1=S2) and OK then Begin
  1297.         GetRec(CFile,N,FTemp);
  1298.         GetRec(CFile,R,FileRec);
  1299.         MatchCount:=MatchCount+1;
  1300.         If PrintCount=0 then Begin
  1301.           WriteLn(Lst,'Listing of duplicate file NAMES found in LITTLCAT database on ',TDate);
  1302.           WriteLn(Lst,ConstStr('-',79));
  1303.           WriteLn(Lst);
  1304.           PrintCount:=3;
  1305.         End;
  1306.         If FileRec.VolName<>OldVolumeName then begin
  1307.           MatchCount:=MatchCount+1;
  1308.           Write(Lst,FTemp.FileName,' on ',FTemp.VolName,' same as ');
  1309.           WriteLn(Lst,FileRec.FileName,' on ',FileRec.VolName);
  1310.           PrintCount:=PrintCount+1;
  1311.           If PrintCount >=55 then begin
  1312.             Write(Lst,#12);
  1313.             PrintCount:=0;
  1314.           End;
  1315.         End;
  1316.       End;
  1317.       S1:=S2;
  1318.       N:=R;
  1319.     End;;
  1320.     ClrScr;
  1321.     GotoXY(22,10);
  1322.     Beep;
  1323.     WriteLn(MatchCount,' matches found... press any key.');
  1324.     Read(Kbd,Ch);
  1325.     If MatchCount>0 then begin
  1326.       WriteLn(Lst);
  1327.       WriteLn(Lst,MatchCount,' matches found.');
  1328.       MatchCount:=0;
  1329.     End;
  1330.     If PrintCount>0 then Write(Lst,#12);
  1331.     PrintCount:=0;
  1332.     RestoreCursor;
  1333.     RestoreScreen;
  1334.     CloseFiles;
  1335.   End; { procedure TestIt2 }
  1336.  
  1337. PROCEDURE InitializeFiles;
  1338.   Begin
  1339.     ChDir(EntryDirectory);
  1340.     OpenFile(CFile,'LITTLCAT.DAT',SizeOf(FRec));
  1341.     If OK then OpenIndex(CIndex,'LITTLCAT.IXN',14,1);
  1342.     If NOT OK then begin
  1343.       Beep;
  1344.       GotoXY(5,25);
  1345.       Write('Files not found.  Creating new files.');
  1346.       MakeFile(CFile,'LITTLCAT.DAT',SizeOf(FRec));
  1347.       MakeIndex(CIndex,'LITTLCAT.IXN',14,1);
  1348.     End;
  1349.     CloseFile(CFile);
  1350.     CloseIndex(CIndex);
  1351.     GotoXY(1,25);ClrEol;
  1352.     InitFiles:=True;
  1353.   End; { procedure InitializeFiles }
  1354.  
  1355. PROCEDURE DoEntry;
  1356.   VAR I,N,RecNum:Integer;
  1357.       SkipDup:Boolean;
  1358.   PROCEDURE AddRecord;
  1359.     Begin
  1360.       With FileRec do begin
  1361.         Status:=0;
  1362.         FileName:=Entry[N].FileName;
  1363.         FileExt:=Entry[N].FileExt;
  1364.         FileTime:=Entry[N].FileTime;
  1365.         FileDate:=Entry[N].FileDate;
  1366.         For I := 1 to 4 do FileSize[I]:=Entry[N].FileSize[I];
  1367.         VolName:=OldVolumeName;
  1368.       End;
  1369.       FKey:=Entry[N].FileName+Entry[N].FileExt;
  1370.       FKey:=FKey+ConstStr(' ',13-Length(FKey));
  1371.       AddRec(CFile,RecNum,FileRec);
  1372.       If OK then begin
  1373.         AddKey(CIndex,RecNum,FKey);
  1374.       End;
  1375.       If NOT OK then begin
  1376.         DeleteRec(CFile,RecNum);
  1377.         GotoXY(1,24);ClrEol;
  1378.         Beep;
  1379.         Write('Error writing Record');
  1380.       End;
  1381.     End; { procedure AddRecord }
  1382.  
  1383.   Begin
  1384.     ShowScreen;
  1385.     FillChar(FileRec,SizeOf(FileRec),0);
  1386.     GotoXY(1,23);
  1387.     Write('Use Cursor UP, DOWN, HOME, END, PGUP, and PGDN, then');
  1388.     GotoXY(1,24);
  1389.     Write('press Return to select file from list.  Press ESC to quit. -->');
  1390.     GotoXY(1,25);
  1391.     Write('Press <F1> to enter ALL files   <S> to SORT into alpha order');
  1392.     SaveScreen;
  1393.     DrawBox(65,79,1,25);
  1394.     BigWindow(66,2,78,24);
  1395.     If MonitorType = 7 then begin
  1396.       HideCursor;
  1397.       For I:=1 to 23 do begin
  1398.         GotoXY(1,I);
  1399.         Write(ConstStr(' ',13));
  1400.       End;
  1401.       RestoreCursor;
  1402.       GotoXY(1,1);
  1403.     End Else ClrScr;
  1404.     LowVideo;
  1405.     UpdateArray;
  1406.     NormVideo;
  1407.     N:=SelectFile;
  1408.     BigWindow(1,1,80,25);
  1409.     RestoreScreen;
  1410.     GotoXY(1,23);ClrEol;
  1411.     GotoXY(1,24);ClrEol;
  1412.     NormVideo;
  1413.     If N=0 then Exit;
  1414.     If N=-1 then begin
  1415.       For I:=23 to 25 do begin
  1416.         GotoXY(1,I);
  1417.         ClrEol;
  1418.       End;
  1419.       GotoXY(1,24);
  1420.       Write('Enter ALL ',EntryNum,' files into database... Continue?  Y/N');
  1421.       Beep;
  1422.       If YES then begin
  1423.         GotoXY(1,24);ClrEol;
  1424.         Write('Ignore duplicate file names?  Y/N');
  1425.         Beep;
  1426.         SkipDup:=False;
  1427.         If YES then SkipDup:=True;
  1428.         OpenFiles;
  1429.         For N:=1 to EntryNum do begin
  1430.           ShowEntry(N);
  1431.           If (Entry[N].Status=1) and SkipDup then begin
  1432.             GotoXY(1,24);ClrEol;
  1433.             Write('Ignoring duplicate filename:  ',Entry[N].FileName,'.',Entry[N].FileExt);
  1434.             Boop;
  1435.           End Else begin
  1436.             FillChar(FTemp,SizeOf(FTemp),0);
  1437.             FileRec:=FTemp;
  1438.             AddRecord;
  1439.           End;
  1440.         End;
  1441.         CloseFiles;
  1442.       End;
  1443.       Exit;
  1444.     End;
  1445.     ShowEntry(N);
  1446.     FillChar(FTemp,SizeOf(FTemp),0);
  1447.     OpenFiles;
  1448.     FileRec:=FTemp;
  1449.     For I:=23 to 25 do begin
  1450.       GotoXY(1,I);ClrEol;
  1451.     End;
  1452.     GotoXY(1,23);
  1453.     Write('ADD the above entry to the database? Y/N ');
  1454.     Beep;
  1455.     If YES then AddRecord;
  1456.     CloseFiles;
  1457.     For I:=23 to 25 do begin
  1458.       GotoXY(1,I);ClrEol;
  1459.     End;
  1460.     GotoXY(1,23);
  1461.     Write('Another entry from this disk/directory? Y/N ');
  1462.     Beep;
  1463.     If YES then DoEntry;
  1464.   End; { procedure DoEntry }
  1465.  
  1466.  
  1467. PROCEDURE Inp;
  1468.   VAR N,I : Integer;
  1469.       S:AnyStr;
  1470.       S1:String[4];
  1471.   Begin
  1472.     If MonitorType = 7 then begin
  1473.       For I:=7 to 25 do begin
  1474.         GotoXY(1,I);
  1475.         ClrEol;
  1476.       End;
  1477.     End Else begin
  1478.       BigWindow(1,7,80,25);
  1479.       ClrScr;
  1480.     End;
  1481.     BigWindow(1,8,80,24);
  1482.     Beep;
  1483.     GotoXY(1,1);
  1484.     WriteLn('Position printer at beginning of new page.  Press any key when ready.');
  1485.     Read(Kbd,Ch);
  1486.     HideCursor;
  1487.     OpenFiles;
  1488.     For N := 1 to FileLen(CFile)-1 do begin
  1489.       GetRec(CFile,N,FTemp);
  1490.       If FTemp.Status=0 then begin
  1491.         S:=FTemp.FileName+'.'+FTemp.FileExt;
  1492.         While Pos(' ',S)>0 do Delete(S,Pos(' ',S),1);
  1493.         Write(S);
  1494.         Write(' on diskette ');
  1495.         WriteLn(FTemp.VolName);
  1496.         If (DiskMatch and (FTemp.VolName=MatchName))
  1497.           or (NOT DiskMatch) then SortRelease(FTemp);
  1498.       End;
  1499.     End;
  1500.     CloseFiles;
  1501.     BigWindow(1,1,80,25);
  1502.   End; { procedure Inp }
  1503.  
  1504. FUNCTION Less;
  1505.   VAR First  : FRec Absolute X;
  1506.       Second : FRec Absolute Y;
  1507.   Begin
  1508.     Less:= (First.VolName<Second.VolName) or
  1509.            ((First.VolName=Second.VolName) and
  1510.             (First.FileName<Second.FileName)) or
  1511.            ((First.VolName=Second.VolName) and
  1512.             (First.FileName=Second.FileName) and
  1513.             (First.FileExt<Second.FileExt));
  1514.   End; { function Less }
  1515.  
  1516. PROCEDURE OutP;
  1517.   CONST Header = 'Alphabetical Listing of Disks and Related Files';
  1518.   VAR N,I,Count,Page:Integer;
  1519.       S1,S2,S3,Head:Str80;
  1520.   Begin
  1521.     If ReportChoice <> 'c' then begin
  1522.       If MonitorType = 7 then begin
  1523.         For I:=7 to 25 do begin
  1524.           GotoXY(1,I);
  1525.           ClrEol;
  1526.         End;
  1527.       End Else begin
  1528.         BigWindow(1,7,80,25);
  1529.         ClrScr;
  1530.       End;
  1531.       BigWindow(1,8,80,24);GotoXY(1,1);
  1532.       WriteLn('---- SORTING COMPLETE, NOW PRINTING --------------');
  1533.       WriteLn;
  1534.       If NOT PRTest then repeat
  1535.         Beep;
  1536.         WriteLn('PRINTER NOT READY. Please correct and press any key when ready or ESC to Quit.');
  1537.         Read(Kbd,Ch);
  1538.         If (Ch=#27) and (NOT Keypressed) then begin
  1539.           BigWindow(1,1,80,25);
  1540.           Exit;
  1541.         End;
  1542.       until PRTest;
  1543.       HideCursor;
  1544.     End;
  1545.     S3:='';
  1546.     Page:=1;
  1547.     Count:=0;
  1548.     Head:=Header;
  1549.     Head:=Head+' on '+TDate;
  1550.     While NOT SortEOS do begin
  1551.       With FTemp do begin
  1552.         If (Count>=55) or (Page=1) then begin
  1553.           If Page<>1 then Write(Lst,#12);
  1554.           WriteLn(Lst,Head,ConstStr(' ',71-Length(Head)),'Page ',Page);
  1555.           WriteLn(Lst,ConstStr('-',79));
  1556.           WriteLn(Lst);
  1557.           Page:=Page+1;
  1558.           Count:=3;
  1559.         End;
  1560.         SortReturn(FTemp);
  1561.         S2:=VolName;
  1562.         If S2<>S3 then begin
  1563.           S3:=S2;
  1564.           WriteLn(Lst,S2);
  1565.           Count:=Count+1;
  1566.         End;
  1567.         S1:=FileName+'.'+FileExt;
  1568.         While Pos(' ',S1)>0 do Delete(S1,Pos(' ',S1),1);
  1569.         WriteLn('-> ',S1);
  1570.         Write(Lst,'   ',S1,ConstStr(' ',12-Length(S1)));
  1571.         Size := (FileSize[1] * 1.0) +
  1572.                 (FileSize[2] * 256.0) +
  1573.                 (FileSize[3] * 65536.0);
  1574.         Year := (FileDate shr 9) + 80;
  1575.         Month := (FileDate shl 7) shr 12;
  1576.         Day := (FileDate shl 11) shr 11;
  1577.         Hour := FileTime shr 11;
  1578.         If Hour >= 12 then begin
  1579.           AP := 'p';
  1580.           Hour := Hour - 12;
  1581.         End Else AP := 'a';
  1582.         If Hour = 0 then Hour := 12;
  1583.         Minute := (FileTime shl 5) shr 10;
  1584.         Write(Lst,Size:8:0,' Bytes',Hour:4,':');
  1585.         If Minute < 10 then Write(Lst,'0');
  1586.         Write(Lst,Minute,ap,Month:4,'-');
  1587.         If Day < 10 then Write(Lst,'0');
  1588.         WriteLn(Lst,Day,'-',Year,'   ');
  1589.         Count:=Count+1;
  1590.       End;
  1591.     End;
  1592.     If Count>0 then Write(Lst,#12);
  1593.     BigWindow(1,1,80,25);
  1594.   End; { procedure OutP }
  1595.  
  1596. PROCEDURE BrowseEdit;
  1597.   VAR S,S1,S2,SKey,FKey:AnyStr;
  1598.       RecNum:Integer;
  1599.       Done:Boolean;
  1600.       I,J,K:Integer;
  1601.  
  1602.   PROCEDURE EnterSearch;
  1603.     Begin
  1604.       SaveScreen;
  1605.       DrawBox(10,70,17,21);
  1606.       BigWindow(11,18,69,20);
  1607.       If MonitorType = 7 then begin
  1608.         HideCursor;
  1609.         For I:=1 to 3 do begin
  1610.           GotoXY(1,I);
  1611.           Write(ConstStr(' ',59));
  1612.         End;
  1613.         RestoreCursor;
  1614.       End Else ClrScr;
  1615.       LowVideo;
  1616.       GotoXY(5,2);
  1617.       Write('File Name to Search For:');
  1618.       S1:='';
  1619.       RestoreCursor;
  1620.       InputStr(S1,12,30,2,Af,[#13],Ch);
  1621.       For I:= 1 to Length(S1) do S1[I]:=Upcase(S1[I]);
  1622.       I:=Pos('.',S1);
  1623.       If I>0 then
  1624.       While Pos('.',S1)<>9 do S1:=Copy(S1,1,I-1)+' '+Copy(S1,I,length(S1));
  1625.       I:=Pos('.',S1);
  1626.       If I=9 then Delete(S1,I,1);
  1627.       NormVideo;
  1628.       BigWindow(1,1,80,25);
  1629.       RestoreScreen;
  1630.       FKey:=S1;
  1631.       SKey:=S1;
  1632.       HideCursor;
  1633.     End; { procedure EnterSearch }
  1634.  
  1635.     PROCEDURE FileSearch;
  1636.       Begin
  1637.         SearchKey(CIndex,RecNum,FKey);
  1638.         S1:=Copy(FKey,1,11);
  1639.         Done:=False;
  1640.         If NOT OK then begin
  1641.           Boop;
  1642.           GotoXY(1,1); Write(S2,' not found');
  1643.           If NOT OK then begin
  1644.             FKey:='';
  1645.             ClearKey(CIndex);
  1646.             SearchKey(CIndex,RecNum,FKey);
  1647.           End;
  1648.         End;
  1649.         If Ok then begin
  1650.         Repeat
  1651.           ShowData(RecNum);
  1652.           GotoXY(1,23);
  1653.           Write('Browsing Records Currently Entered in FILECAT Database...');
  1654.           ClrEol;
  1655.           GotoXY(1,25);
  1656.           Write('        <N> Next  <P> Previous  <S> Search');
  1657.           ClrEol;
  1658.           GotoXY(1,24);
  1659.           Write('Press:  <Q> Quit  <D> Delete  ');
  1660.           ClrEol;
  1661.           Repeat
  1662.             Read(Kbd,Ch);
  1663.             Ch:=Upcase(Ch);
  1664.             If NOT (Ch in ['N','P','Q','D','S']) then Boop;
  1665.             Until Ch in ['N','P','Q','D','S'];
  1666.             Case Ch of
  1667.               'Q' : Done:=True;
  1668.               'N' : Begin
  1669.                       NextKey(CIndex,RecNum,FKey);
  1670.                       GotoXY(1,1); Write(ConstStr(' ',40)); GotoXY(1,1);
  1671.                       If NOT OK then Write('First Record');
  1672.                       If NOT OK then NextKey(CIndex,RecNum,FKey);
  1673.                     End;
  1674.               'P' : Begin
  1675.                       PrevKey(CIndex,RecNum,FKey);
  1676.                       GotoXY(1,1); Write(ConstStr(' ',40)); GotoXY(1,1);
  1677.                       If NOT OK then Write('Last Record ');
  1678.                       If NOT OK then PrevKey(CIndex,RecNum,FKey);
  1679.                     End;
  1680.               'D' : Begin
  1681.                       SaveScreen;
  1682.                       DrawBox(10,70,17,21);
  1683.                       BigWindow(11,18,69,20);
  1684.                       If MonitorType = 7 then begin
  1685.                         For I:=1 to 3 do begin
  1686.                           GotoXY(1,I);
  1687.                           Write(ConstStr(' ',59));
  1688.                         End;
  1689.                       End Else ClrScr;
  1690.                       LowVideo;
  1691.                       GotoXY(21,2);
  1692.                       Beep;
  1693.                       TextColor(7+Blink);
  1694.                       HideCursor;
  1695.                       Write('Are you sure? Y/N');
  1696.                       NormVideo;
  1697.                       If YES then begin
  1698.                         DeleteRec(CFile,RecNum);
  1699.                         DeleteKey(CIndex,RecNum,FKey);
  1700.                         SearchKey(CIndex,RecNum,FKey);
  1701.                       End;
  1702.                       BigWindow(1,1,80,25);
  1703.                       RestoreScreen;
  1704.                       HideCursor;
  1705.                     End;
  1706.               'S' : Begin
  1707.                       GotoXY(1,1); Write(ConstStr(' ',40));
  1708.                       S2:=FKey;
  1709.                       EnterSearch;
  1710.                       S1:=FKey;
  1711.                       ClearKey(CIndex);
  1712.                       SearchKey(CIndex,RecNum,FKey);
  1713.                       If (Copy(FKey,1,Length(S1))<>S1) or (NOT OK) then begin
  1714.                         Boop;
  1715.                         GotoXY(1,1); Write(S1,' not found');
  1716.                         If NOT OK then begin
  1717.                           FKey:=S2;
  1718.                           ClearKey(CIndex);
  1719.                           SearchKey(CIndex,RecNum,FKey);
  1720.                         End;
  1721.                       End;
  1722.                       NormVideo;
  1723.                     End;
  1724.             End;
  1725.           Until Done;
  1726.         End;
  1727.       End; { procedure FileSearch }
  1728.  
  1729.   Begin
  1730.     ShowScreen;
  1731.     EnterSearch;
  1732.     GotoXY(60,1);
  1733.     Write('Browse / Delete');
  1734.     S2:=FKey;
  1735.     OpenFiles;
  1736.     FileSearch;
  1737.     CloseFiles;
  1738.     RestoreCursor;
  1739.   End; { procedure BrowseEdit }
  1740.  
  1741. PROCEDURE Menu;
  1742.   LABEL 1;
  1743.   CONST N = 17;
  1744.   VAR S:AnyStr;
  1745.       I:Integer;
  1746.       R:Real;
  1747.  
  1748.   PROCEDURE GetVolumeName;
  1749.     Begin
  1750.       If NOT ChangedToSource then Begin
  1751.         Beep;
  1752.         GotoXY(30,9);ClrEol;
  1753.         Write(SourceDirectory,' Drive Not Ready');
  1754.         OldVolumeName:='<NONE>';
  1755.         OldVolumeNameDate:='';
  1756.       End Else Volume(SourceDirectory[1],False);
  1757.       ChDir(EntryDirectory);
  1758.       LowVideo;
  1759.       GotoXY(17,10); ClrEol;
  1760.       Write('Volume Name: ',OldVolumeName,'   ',OldVolumeNameDate);
  1761.     End; { procedure GetVolumeName }
  1762.  
  1763.   Begin
  1764.   Repeat
  1765.     NormVideo;
  1766.     If NewMenu then DisplayID Else Begin
  1767.       If MonitorType = 7 then begin
  1768.         For I:=7 to 25 do begin
  1769.           GotoXY(1,I);
  1770.           ClrEol;
  1771.         End;
  1772.       End Else begin
  1773.         BigWindow(1,7,80,25);
  1774.         ClrScr;
  1775.       End;
  1776.       BigWindow(1,1,80,25);
  1777.     End;
  1778.     For I:=1 to Length(EntryDirectory) do
  1779.       EntryDirectory[I]:=UpCase(EntryDirectory[I]);
  1780.     Repeat
  1781.       S:=EntryDirectory;
  1782.       If EntryDirectory[Length(EntryDirectory)]='\'then
  1783.         S := S + 'LITTLCAT.DAT' Else
  1784.         S := S + '\LITTLCAT.DAT';
  1785.       If NOT Exist(S) then begin
  1786.         HideCursor;
  1787.         GotoXY(5,12);
  1788.         Write('Please place the');
  1789.         GotoXY(5,13);
  1790.         Write('LITTLCAT data disk in ',EntryDirectory);
  1791.         GotoXY(5,16);
  1792.         Beep;
  1793.         Write('Press <ESC> to Quit and return to DOS');
  1794.         GotoXY(5,18);
  1795.         Write('      or any key to continue...');
  1796.         Read(Kbd,Ch);
  1797.         If (Ch=#27) and Keypressed then Read(Kbd,Ch);
  1798.         RestoreCursor;
  1799.         If Ch=#27 then begin
  1800.           ClrScr;
  1801.           Halt;
  1802.         End;
  1803.         KillTemp;
  1804.         InitializeFiles;
  1805.         If MonitorType = 7 then begin
  1806.           For I:=7 to 25 do begin
  1807.             GotoXY(1,I);
  1808.             ClrEol;
  1809.           End;
  1810.         End Else begin
  1811.           BigWindow(1,7,80,25);
  1812.           ClrScr;
  1813.         End;
  1814.         BigWindow(1,1,80,25);
  1815.       End;
  1816.     until Exist(S);
  1817.     R:=FreeSpace;
  1818.  
  1819.     LowVideo;
  1820.     HideCursor;
  1821.     GotoXY(9,8); Write('LITTLCAT Resides on: ',EntryDirectory);
  1822.     If R<2000.0 then NormVideo;
  1823.     GotoXY(1,25); Write(R:1:0,' Left on ',EntryDirectory);
  1824.     If R<2000.00 then begin
  1825.       Beep;
  1826.       Textcolor(7+Blink);
  1827.       Write(' <--Disk almost full!');
  1828.       Delay(2000);
  1829.       LowVideo;
  1830.     End;
  1831.     GotoXY(70,8); Write('DOS: ',DOSNum);
  1832.     GotoXY(6,9); ClrEol; Write('Source Drive/Directory: ',SourceDirectory);
  1833.     OldVolumeName := '';
  1834.     OldVolumeNameDate := '';
  1835.     NormVideo;
  1836.     GotoXY(N,12); WriteLn('1 -- CHANGE Source Drive/Directory');
  1837.     GotoXY(N,13); WriteLn('2 -- ENTER New File Data');
  1838.     GotoXY(N,14); WriteLn('3 -- BROWSE / DELETE LittlCat Records');
  1839.     GotoXY(N,15); WriteLn('4 -- TEST LITTLCAT Database / SOURCE Diskette for Dups');
  1840.     GotoXY(N,16); WriteLn('5 -- PRINT Catalog of Disks');
  1841.     GotoXY(N,17); WriteLn('6 -- LABEL Source Diskette');
  1842.     LowVideo;
  1843.     GotoXY(N,19); WriteLn('7 -- Set Epson Print Codes');
  1844.     GotoXY(N,20); WriteLn('8 -- Change Color');
  1845.     GotoXY(N,21); WriteLn('9 -- End');
  1846.     NormVideo;
  1847.     If SourceDirectory[1] in ['A','B'] then GetVolumeName;
  1848.     GotoXY(N,23); Write('Enter your selection: [ ]');
  1849.     Repeat
  1850.       ReStoreCursor;
  1851.       GotoXY(N+23,WhereY);
  1852.       Read(Kbd,MenuChoice);
  1853.       Write(MenuChoice);
  1854.       If MenuChoice in ['2'..'5'] then begin
  1855.         Repeat
  1856.           INT24On;
  1857.           {$I-}
  1858.           ChDir(EntryDirectory);
  1859.           {$I+}
  1860.           I:=INT24Result;
  1861.           INT24Off;
  1862.           If I<>0 then Begin
  1863.             Beep;
  1864.             GotoXY(30,8);ClrEol;
  1865.             Write(EntryDirectory,' Drive Not Ready');
  1866.             Read(Kbd,Ch);
  1867.           End;
  1868.         Until I=0;
  1869.         If (NOT Exist('LITTLCAT.DAT')) or
  1870.            (NOT Exist('LITTLCAT.IXN')) then Menu;
  1871.       End;
  1872.       Case MenuChoice of
  1873.         '1' : Begin                          { Change Directory }
  1874.                 NewMenu:=False;
  1875.                 S := '';
  1876.                 GotoXY(30,9); ClrEol;
  1877.                 ReadLn(S);
  1878.                 S:=S[1];
  1879.                 If Length(S)=1 then S:=S+':';
  1880.                 If Length(S)=2 then S:=S+'\';
  1881.                 INT24On;
  1882.                 {$I-}
  1883.                 ChDir(S);
  1884.                 {$I+}
  1885.                 For I:=1 to Length(S) do S[I]:=UpCase(S[I]);
  1886.                 I:=INT24Result;
  1887.                 INT24Off;
  1888.                 If (I<>0) or (NOT (S[1] in ['A','B'])) then Begin
  1889.                   Beep;
  1890.                   GotoXY(30,9);
  1891.                   Write('Drive Not Ready or Illegal Definition');
  1892.                   Delay(1000);
  1893.                 End Else SourceDirectory:=S;
  1894.                 LowVideo;
  1895.                 GotoXY(10,9); WriteLn('  Source Directory: ',SourceDirectory);
  1896.                 NormVideo;
  1897.                 ChDir(EntryDirectory);
  1898.               End;
  1899.         '2' : Begin
  1900.                 NewMenu:=True;
  1901.                 If SourceDirectory[1] in ['A','B'] then GetVolumeName;
  1902.                 If ChangedToSource then begin
  1903.                   BuildArray;
  1904.                   If EntryNum>0 then DoEntry;
  1905.                 End Else Begin
  1906.                   Beep;
  1907.                   GotoXY(30,9); ClrEol;
  1908.                   Write(SourceDirectory,' Drive Not Ready');
  1909.                   Delay(1000);
  1910.                 End;
  1911.                 ChDir(EntryDirectory);
  1912.               End;
  1913.         '3' : Begin
  1914.                 BrowseEdit;
  1915.                 NewMenu:=True;
  1916.               End;
  1917.         '4' : Begin
  1918.                 NewMenu:=False;
  1919.                 SaveScreen;
  1920.                 NormVideo;
  1921.                 DrawBox(10,70,16,20);
  1922.                 LowVideo;
  1923.                 BigWindow(11,17,69,19);
  1924.                 If MonitorType = 7 then begin
  1925.                   HideCursor;
  1926.                   For I:=1 to 3 do begin
  1927.                     GotoXY(1,I);
  1928.                     Write(ConstStr(' ',59));
  1929.                   End;
  1930.                   RestoreCursor;
  1931.                 End Else ClrScr;
  1932.                 HideCursor;
  1933.                 GotoXY(5,2); WriteLn('Press: <ESC> Quit  <S> Test Source  <D> Test Database');
  1934.                 Beep;
  1935.                 Repeat
  1936.                   Read(Kbd,Ch);
  1937.                   If (Ch=#27) and Keypressed then Read(Kbd,Ch);
  1938.                   Ch:=Upcase(Ch);
  1939.                   If NOT (Ch in ['S','D',#27]) then Boop;
  1940.                 Until Ch in ['S','D',#27];
  1941.                 BigWindow(1,1,80,25);
  1942.                 RestoreCursor;
  1943.                 RestoreScreen;
  1944.                 If Ch= 'D' then begin
  1945.                   ChDir(EntryDirectory);
  1946.                   TestIt2;
  1947.                 End;
  1948.                 If (Ch= 'S') and (ChangedToSource) then begin
  1949.                   BuildArray;
  1950.                   QuickSortRecord(Entry,EntryNum);
  1951.                   If EntryNum>0 then TestIt else Boop;
  1952.                 End Else Boop;
  1953.                 ChDir(EntryDirectory);
  1954.               End;
  1955.         '5' : Begin
  1956.                 DiskMatch:=False;
  1957.                 Beep;
  1958.                 SaveScreen;
  1959.                 NormVideo;
  1960.                 DrawBox(10,70,16,20);
  1961.                 LowVideo;
  1962.                 BigWindow(11,17,69,19);
  1963.                 If MonitorType = 7 then begin
  1964.                   HideCursor;
  1965.                   For I:=1 to 3 do begin
  1966.                     GotoXY(1,I);
  1967.                     Write(ConstStr(' ',59));
  1968.                   End;
  1969.                   RestoreCursor;
  1970.                 End Else ClrScr;
  1971.                 HideCursor;
  1972.                 GotoXY(5,2); WriteLn('List Files on ALL disks?  Y/N');
  1973.                 If NOT Yes then begin
  1974.                   DiskMatch:=True;
  1975.                   GotoXY(1,2);ClrEol;
  1976.                   GotoXY(4,2);
  1977.                   LowVideo;
  1978.                   Write('Enter Disk Name: ');
  1979.                   NormVideo;
  1980.                   S:=OldVolumeName;
  1981.                   RestoreCursor;
  1982.                   InputStr(S,11,WhereX,WhereY,Af,[#13],Ch);
  1983.                   For I:=1 to Length(S) do S[I]:=Upcase(S[I]);
  1984.                   If S='' then goto 1;
  1985.                   MatchName:=S;
  1986.                 End;
  1987.                 BigWindow(1,1,80,25);
  1988.                 I:=TurboSort(SizeOf(FTemp));
  1989.                 1:
  1990.                 BigWindow(1,1,80,25);
  1991.                 RestoreCursor;
  1992.                 RestoreScreen;
  1993.                 NewMenu:=False;
  1994.               End;
  1995.         '6' : If SourceDirectory[1] in ['A','B'] then begin
  1996.                 Volume(SourceDirectory[1],True);
  1997.                 GetVolumeName;
  1998.                 NewMenu:=False;
  1999.               End;
  2000.         '7' : Begin
  2001.                 SetEpson;
  2002.                 NewMenu:=False;
  2003.               End;
  2004.         '8' : Begin
  2005.                 CMode:=Not Cmode;
  2006.                 If CMode then TextMode(3) Else TextMode(2);
  2007.                 NewMenu:=True;
  2008.                 Menu;
  2009.               End;
  2010.         '9' : ;
  2011.       Else Boop;
  2012.       End;
  2013.     Until MenuChoice in ['1'..'9'];
  2014.   Until MenuChoice = '9';
  2015.   End;
  2016.  
  2017. Begin
  2018.   InitIndex;
  2019.   KillTemp;
  2020.   DOSNum:=CheckDosVersion;
  2021.   If MonitorType = 7 then begin
  2022.     TextMode(2);
  2023.     CMode:=False;
  2024.   End Else begin
  2025.     TextMode(3);
  2026.     CMode:=True;
  2027.   End;
  2028.   TDate := DOSDate;
  2029.   GetDir(0,EntryDirectory);
  2030.   OvrPath(EntryDirectory);
  2031.   If EntryDirectory[1]='A' then SourceDirectory:='B:\'
  2032.     Else SourceDirectory:='A:\';
  2033.   OldVolumeName:='';
  2034.   InitFiles:=False;
  2035.   NewMenu:=True;
  2036.   PrintCount:=0;
  2037.   FirstCharDelete:=True;
  2038.   CurrentSaved:=False;
  2039.   Menu;
  2040.   KillTemp;
  2041.   ReStoreCursor;
  2042.   ClrScr;
  2043. End.